<template>
    <div>
        <home-header></home-header>
        <home-swiper :swiperList="swiperList"></home-swiper>
        <home-icons :iconList="iconList"></home-icons>
        <home-recommend :recommendList="recommendList"></home-recommend>
    </div>
</template>
<script>
import HomeHeader from './components/Header'
import HomeSwiper from './components/Swiper'
import HomeIcons from './components/Icons'
import HomeRecommend from './components/Recommend'
import axios from 'axios'
export default {
    name:'Home',
    data:function(){
        return{
            swiperList:[],
            iconList:[],
            recommendList:[]
        }
    },
    components:{
        HomeHeader:HomeHeader,
        HomeSwiper:HomeSwiper,
        HomeIcons:HomeIcons,
        HomeRecommend,HomeRecommend
    },
    mounted(){
        this.getHomeInfo();
    },
    methods:{
        getHomeInfo:function(){
            axios.get('/static/mock/data.json')
            .then(this.getHomeInfoSucc);
        },
        getHomeInfoSucc(res){
            res = res.data;
            if(res.ret && res.data){
                const data = res.data;
                this.swiperList = data.swiperList;
                this.iconList = data.iconList;
                this.recommendList = data.recommendList;
            }
        }
    }
}
</script>
<style lang="scss" scoped>
.home{
    font-size: 50px;
}
</style>